import React, { useState } from 'react';
import ChatWindow from './components/ChatWindow';
import SessionManager from './components/SessionManager';
import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faComment, faList } from '@fortawesome/free-solid-svg-icons';
import './App.css';

function App() {
    const [theme, setTheme] = useState('light');
    
    // 切换主题
    const toggleTheme = () => {
        setTheme(theme === 'light' ? 'dark' : 'light');
    };
    
    return (
        <Router>
            <div className={`app-container ${theme}`}>
                {/* 导航栏 */}
                <nav className="app-nav">
                    <div className="nav-logo">
                        <h1>AI聊天助手</h1>
                    </div>
                    <div className="nav-links">
                        <Link to="/" className="nav-link">
                            <FontAwesomeIcon icon={faComment} /> 聊天
                        </Link>
                        <Link to="/sessions" className="nav-link">
                            <FontAwesomeIcon icon={faList} /> 会话管理
                        </Link>
                    </div>
                    <div className="nav-actions">
                        <button className="theme-toggle" onClick={toggleTheme}>
                            {theme === 'light' ? '🌙' : '☀️'}
                        </button>
                    </div>
                </nav>
                
                {/* 主内容区 */}
                <main className="app-main">
                    <Routes>
                        <Route path="/" element={<ChatWindow />} />
                        <Route path="/sessions" element={<SessionManager />} />
                    </Routes>
                </main>
                
                {/* 页脚 */}
                <footer className="app-footer">
                    <p>© 2025 AI聊天助手 | 一个基于大型语言模型的智能助手</p>
                </footer>
            </div>
        </Router>
    );
}

export default App;    